Handle missing Git in optional repo checks#7639
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the @shopify/cli-kit Git helpers so that optional repository checks don’t surface raw failures when git is missing from PATH, while flows that require Git still fail with a friendly, actionable error.
Changes:
- Made
insideGitDirectory()returnfalsewhen Git is not available (treat as “not a repo” for optional checks). - Updated
ensureInsideGitDirectory()to explicitly require Git first and then perform the repo check. - Added unit tests covering both “Git missing” behaviors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/cli-kit/src/public/node/git.ts | Separates “Git required” vs “optional repo detection” behavior by gating required checks with ensureGitIsPresentOrAbort() and making optional checks return false when Git is absent. |
| packages/cli-kit/src/public/node/git.test.ts | Adds unit tests ensuring missing-Git behavior is friendly for required flows and silent (false) for optional detection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
efc3789 to
0ded558
Compare
0ded558 to
5156580
Compare
karreiro
approved these changes
May 26, 2026
Contributor
karreiro
left a comment
There was a problem hiding this comment.
Thank you, @charlespwd!
gonzaloriestra
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Some theme workflows use Git only as an optional safety check before continuing. When Git is not installed or unavailable on PATH, those checks should not surface raw command failures to users.
What changed
Testing
pnpm vitest run packages/cli-kit/src/public/node/git.test.ts --config packages/cli-kit/vite.config.tspnpm vitest run packages/theme/src/cli/services/pull.test.ts --config packages/theme/vite.config.tsFixes shop/issues#47568